import yagmail,logging
import pytest,os

def log():
    log = logging.basicConfig(
        level=logging.DEBUG,
        filemode='a+',
        filename=r'E:\gg4\Auto_wms\Api_A3mall\log/a3mall.log',
        format='%(levelname)s-%(filename)s-%(asctime)s-%(message)s-%(lineno)d'
    )
    return log

def mail():
    mail = yagmail.SMTP(user='3080172040@qq.com',password='abhdfnpkqkmadgff',host='smtp.qq.com')
    mail.send(to='3080172040@qq.com',
              subject='A3mall自动化测试',
              contents=[
                  'A3mall自动化测试',
                  r'E:\gg4\Auto_wms\Api_A3mall\log/a3mall.log',
                  r'E:\gg4\Auto_wms\Api_A3mall\reports\a3mall.html'
              ])
    mail.close()

def allure():
    pytest.main([
        '-s',
        r'E:\gg4\Auto_wms\Api_A3mall\cases\Test_case.py',
        '--clean-alluredir',
        '--alluredir=./report',
        '--html=./a3mall.html'
    ])
    os.system('allure generate -o ./html ./report ./html --clean')